package org.colcon.web.client.ui;

import org.colcon.web.client.Collective_Congress;

import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.Event;

public abstract class ClickablePanel extends ColConPanel 
{
	public ClickablePanel(Collective_Congress client)
	{
		this(client, null, null);
	}
	
	public ClickablePanel(Collective_Congress client, String style)
	{
		this(client, style, null);
	}
	
	public ClickablePanel(Collective_Congress client, String style, String text) 
	{
		super(client, style, text);
		addStyleName("clickable");
		
		sinkEvents(Event.ONCLICK);
		addHandler(new MyHandler(), ClickEvent.getType());
	}

	public abstract void click();
	
	private class MyHandler implements ClickHandler
	{
		public void onClick(ClickEvent event) 
		{
			click();
		}
	}
}
